package com.shopping.controller;

import com.shopping.pojo.Result;
import com.shopping.pojo.User;
import com.shopping.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/api/register")
public class RegisterController {
    @Autowired
    private UserService userService;


    //顾客注册
    @PostMapping
    public Result UserLogin(@RequestBody User user){
        log.info("顾客注册:{}",user);
        boolean u=userService.UserRegister(user);
        return u  ? Result.success() : Result.error("该用户名已存在");
    }

}
